package com.atguigu.flink.streamapi.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Smexy on 2023/1/12
 *      测试场景主要去验证程序逻辑是否正确。
 *          模拟一些测试数据
 */
public class Demo1_Test
{
    public static void main(String[] args) {
        
      StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

      env.setParallelism(1);

      //快速创建一个用于测试的数据源
       // DataStreamSource<Integer> ds = env.fromElements(1, 2, 3, 4, 5, 6);

        //基于集合构造数据源
        List<Integer> data = Arrays.asList(1, 22, 3);
        DataStreamSource<Integer> ds = env.fromCollection(data);

        ds.print();

        try {
          env.execute();
      } catch (Exception e) {
          e.printStackTrace();
      }

    }
}
